/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view_controller;

import javax.swing.JOptionPane;
import model.Mahasiswa;
import dao.MahasiswaDao;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import java.text.SimpleDateFormat;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.plaf.synth.SynthLookAndFeel;

/**
 *
 * @author shofyan
 */
public class MahasiswaView extends javax.swing.JFrame {
    
    

    /**
     * Creates new form MahasiswaView
     */
    DefaultTableModel model;
    MahasiswaDao dao = new MahasiswaDao();
     cobaPanel haha = cobaPanel.getInstance();

    public MahasiswaView() throws SQLException  {
        Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screenSize = tk.getScreenSize();
final int WIDTH1 = screenSize.width;
final int HEIGHT1 = screenSize.height;
// Setup the frame accordingly
// This is assuming you are extending the JFrame //class
setSize((WIDTH1 / 2), (HEIGHT1 /2));

        setLocation(WIDTH1 / 4, WIDTH1 / 4);
        initComponents();
        model = new DefaultTableModel();
        
         
      tablemahasiswa.setModel(model);
        model.addColumn("NIM");
        model.addColumn("Nama");
        model.addColumn("TanggalLahir");
        model.addColumn("Jurusan");
        model.addColumn("Alamat");
        
          

      loadData();
      
      
    }

    public Mahasiswa getDataRow(JTable tabel){
    Mahasiswa mhs = new Mahasiswa();
    int i = tabel.getSelectedRow();
    
    if (i==-1){
        
    return mhs;
    }
    
    mhs.setNIM((String)model.getValueAt(i, 0));
    mhs.setName((String)model.getValueAt(i, 1));
    //Object jj =  model.getValueAt(i,2);
    java.util.Date jj = (java.util.Date) model.getValueAt(i,2);
//    String[] waktu = jj.toString().split("-");
//    int tahun =Integer.parseInt(waktu[0]);
//    int bulan =Integer.parseInt(waktu[1]);
//    int tgl =Integer.parseInt(waktu[2]);
//    
//    Calendar CC = Calendar.getInstance();
//   
//    
//    CC.set(tahun, bulan, tgl);
//    
//   String kk ="";
//   
//    kk=kk+CC.getTime();
//    kk=kk+"/";
//    kk=kk+CC.MONTH;
//    kk=kk+"/";
//    kk=kk+CC.YEAR;
    
    SimpleDateFormat format = new SimpleDateFormat("d/M/yyyy");
    
    mhs.setTanggalLahir(jj);
    mhs.setJurusan((String)model.getValueAt(i, 3));
    mhs.setAlamat((String)model.getValueAt(i, 4));
    
    txtNIM.setText(mhs.getNIM());
    txtNama.setText(mhs.getName());
    txtTglLahir.setText(format.format(jj));
    txtJurusan.setText(mhs.getJurusan());
    txtAlamat.setText(mhs.getAlamat());
    
    
        return mhs;
    }
    public void loadData() throws SQLException {
        model.getDataVector().removeAllElements();
        
        model.fireTableDataChanged();
        List<Mahasiswa> Mahasiswas = dao.getAll();
        try {
              if (Mahasiswas != null || Mahasiswas.size() > 0) {
            for (Mahasiswa mhs : Mahasiswas) {
                Object[] o = new Object[5];
                o[0] = mhs.getNIM();
                o[1] = mhs.getName();
                o[2] = mhs.getTanggalLahir().toString();
                o[3] = mhs.getJurusan();
                o[4] = mhs.getAlamat();
                
                model.addRow(o);
           
                    }
        }
        } catch (Exception e) {
            
            System.out.println("kenapa hayoo"+e);
        }
      
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txtNIM = new javax.swing.JTextField();
        txtNama = new javax.swing.JTextField();
        txtJurusan = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAlamat = new javax.swing.JTextArea();
        btnUbah = new javax.swing.JButton();
        btnTambah = new javax.swing.JButton();
        btnHapus = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tablemahasiswa = new javax.swing.JTable();
        txtTglLahir = new javax.swing.JFormattedTextField();
        jDateChooser2 = new com.toedter.calendar.JDateChooser();
        jButton1 = new javax.swing.JButton();
        lihat = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(102, 102, 102));
        setIconImages(null);

        jPanel1.setBackground(new java.awt.Color(102, 102, 102));

        jLabel1.setFont(new java.awt.Font("Batang", 0, 14)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("NIM");

        jLabel2.setFont(new java.awt.Font("Batang", 0, 14)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Nama");

        jLabel3.setFont(new java.awt.Font("Batang", 0, 14)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Tanggal Lahir");

        jLabel4.setFont(new java.awt.Font("Batang", 0, 14)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Jurusan");

        jLabel5.setFont(new java.awt.Font("Batang", 0, 14)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("Alamat");

        txtNIM.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNIMActionPerformed(evt);
            }
        });

        txtNama.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNamaActionPerformed(evt);
            }
        });

        txtAlamat.setColumns(20);
        txtAlamat.setRows(5);
        jScrollPane1.setViewportView(txtAlamat);

        btnUbah.setText("Ubah");
        btnUbah.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUbahActionPerformed(evt);
            }
        });

        btnTambah.setText("Tambah");
        btnTambah.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTambahActionPerformed(evt);
            }
        });

        btnHapus.setText("Hapus");
        btnHapus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHapusActionPerformed(evt);
            }
        });

        tablemahasiswa.setAutoCreateRowSorter(true);
        tablemahasiswa.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4", "Title 5"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tablemahasiswa.setToolTipText("Tabel mahasiswa");
        tablemahasiswa.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        tablemahasiswa.setFocusTraversalPolicyProvider(true);
        tablemahasiswa.getTableHeader().setReorderingAllowed(false);
        tablemahasiswa.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tablemahasiswaMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tablemahasiswa);

        txtTglLahir.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("d/M/yyyy"))));

        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        lihat.setText("lihat");
        lihat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(95, 95, 95)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 540, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(141, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txtTglLahir, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lihat)
                    .addComponent(jButton1)
                    .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(82, 82, 82))
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGap(51, 51, 51)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(btnTambah)
                            .addGap(10, 10, 10)
                            .addComponent(btnUbah)
                            .addGap(18, 18, 18)
                            .addComponent(btnHapus))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel3)
                                .addComponent(jLabel4)
                                .addComponent(jLabel5)
                                .addComponent(jLabel1)
                                .addComponent(jLabel2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(txtJurusan, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(txtNama, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                                .addComponent(txtNIM, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE))))
                    .addContainerGap(324, Short.MAX_VALUE)))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(95, 95, 95)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jDateChooser2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtTglLahir))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addGap(18, 18, 18)
                .addComponent(lihat)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 121, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(25, 25, 25))
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addContainerGap(31, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(txtNIM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(txtNama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel3)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4)
                        .addComponent(txtJurusan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel5)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(11, 11, 11)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btnUbah)
                        .addComponent(btnHapus)
                        .addComponent(btnTambah))
                    .addGap(369, 369, 369)))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtNIMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNIMActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNIMActionPerformed

    private void btnTambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTambahActionPerformed
        // TODO add your handling code here:

        Mahasiswa mhs = new Mahasiswa();
        mhs = BindData();
        if (validateInput(mhs)) {

            if (dao.insertMahasiswa(mhs)) {

                JOptionPane.showMessageDialog(this, "insert berhasil", "validasi", JOptionPane.INFORMATION_MESSAGE);
            }
        }
        try {
            loadData();
        } catch (SQLException ex) {
            Logger.getLogger(MahasiswaView.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_btnTambahActionPerformed

    private void btnUbahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUbahActionPerformed
        // TODO add your handling code here:
       Mahasiswa mhs = new Mahasiswa(); 
      mhs =  BindData();
        
        if ( validateInput(mhs)){
            dao.UpdateMahasiswa(mhs);
            JOptionPane.showMessageDialog(this, "Update berhasil", "validasi", JOptionPane.INFORMATION_MESSAGE);
            try {
                loadData();
            } catch (SQLException ex) {
                Logger.getLogger(MahasiswaView.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnUbahActionPerformed

    private void tablemahasiswaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablemahasiswaMouseClicked
        // TODO add your handling code here:
        
        Mahasiswa msh = getDataRow(tablemahasiswa);
    }//GEN-LAST:event_tablemahasiswaMouseClicked

    private void btnHapusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHapusActionPerformed
        // TODO add your handling code here:
        System.out.println("haisemua");
    }//GEN-LAST:event_btnHapusActionPerformed

    private void txtNamaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNamaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNamaActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
       
        haha.setVisible(true);
       
        
    }//GEN-LAST:event_jButton1ActionPerformed

    private void lihatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatActionPerformed
        // TODO add your handling code here:
        String conba = haha.Getdate();
        JOptionPane.showMessageDialog(this, conba);
    }//GEN-LAST:event_lihatActionPerformed

    public Mahasiswa BindData() {

        Mahasiswa mhs = new Mahasiswa();
        if (!txtNIM.getText().isEmpty()) {
            mhs.setNIM(txtNIM.getText());
        }
        if (!txtNama.getText().isEmpty()) {
            mhs.setName(txtNama.getText());
        }
        if (!txtJurusan.getText().isEmpty()) {
            mhs.setJurusan(txtJurusan.getText());
        }
        if (!txtTglLahir.getText().isEmpty()) {
            mhs.setTanggalLahir((java.util.Date) txtTglLahir.getValue());
        }
        if (!txtAlamat.getText().isEmpty()) {
            mhs.setAlamat(txtAlamat.getText());
        }
        return mhs;

    }

    public boolean validateInput(Mahasiswa mhs) {
        boolean isValid = true;
        StringBuilder error = new StringBuilder();


        if (mhs.getNIM() == null || "".equals(mhs.getNIM().trim())) {
            error.append("Nim Harus diisi\n");
            isValid = false;
        }
        if (mhs.getName() == null || "".equals(mhs.getName().trim())) {
            error.append("Name Harus diisi\n");
            isValid = false;
        }
        if (mhs.getJurusan() == null || "".equals(mhs.getJurusan())) {
            error.append("Jurusan Harus diisi\n");
            isValid = false;
        }

        if (mhs.getTanggalLahir() == null || "".equals(mhs.getTanggalLahir())) {
            error.append("Tanggal Harus diisi\n");
            isValid = false;
        }

        if (mhs.getAlamat() == null || "".equals(mhs.getAlamat())) {
            error.append("Alamat Harus diisi\n");
            isValid = false;
        }

        if (!isValid) {
            JOptionPane.showMessageDialog(this, error, "validasi", JOptionPane.ERROR_MESSAGE);
        }

        return isValid;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
         try {
         //   javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels();
              
          LookAndFeel   look  = new SynthLookAndFeel();
                   UIManager.setLookAndFeel(new com.jtattoo.plaf.acryl.AcrylLookAndFeel());
        }
            catch (Exception e) {
            System.out.println("hai look");
        }
         
        
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(MahasiswaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(MahasiswaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(MahasiswaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(MahasiswaView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
        //</editor-fold>

        /* Create and display the form */
//               try {
//
//            Thread.sleep(3000);
//
//        } catch (InterruptedException ex) {
//
//            Logger.getLogger(MahasiswaView.class.getName()).log(Level.SEVERE, null, ex);
//
//        }
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                
                try {
               MahasiswaView mshV = new MahasiswaView();

                    mshV.setVisible(true);
               
                    
                } catch (SQLException ex) {
                    Logger.getLogger(MahasiswaView.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnHapus;
    private javax.swing.JButton btnTambah;
    private javax.swing.JButton btnUbah;
    private javax.swing.JButton jButton1;
    private com.toedter.calendar.JDateChooser jDateChooser2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JButton lihat;
    private javax.swing.JTable tablemahasiswa;
    private javax.swing.JTextArea txtAlamat;
    private javax.swing.JTextField txtJurusan;
    private javax.swing.JTextField txtNIM;
    private javax.swing.JTextField txtNama;
    private javax.swing.JFormattedTextField txtTglLahir;
    // End of variables declaration//GEN-END:variables
}
